package oop;

import oop.pat.Person;

import java.io.IOException;
import java.util.Arrays;

public class SimpleMethod {
    //静态方法 static，可以通过"类名.方法名"调用

    //非静态方法 实例化类得到对象，通过"对象.方法名"调用

    //异常抛出
    public void read() throws IOException {}

    public void a() {
        b();
    }

    public void b() {
        a();
    }

    //值传递
    //返回值为空
    public static void change(int a) {
        a =10;
    }

    //引用传递
    //返回值为地址
    public static void arrayChange(int[] array) {
        Arrays.fill(array,1);
    }

    public static void strTest(String name) {
        name = "Lby";
    }

    public static void main(String[] args) {
        int a = 0;
        int[] array = {1,2,5,6};
        String name = "CphRed";
        change(a);
        System.out.println(a);
        arrayChange(array);
        System.out.println(Arrays.toString(array));
        strTest(name);
        System.out.println(name);
        //构造器
        Person person = new Person();
        SimpleMethod method = new SimpleMethod();
        method.a();
    }
}
